﻿// Action script...

// [Action in Frame 1]
function roll(min, max)
{
    var _loc1 = Math.floor(Math.random() * (max - min + 1)) + min;
    return (_loc1);
} // End of the function
function idle()
{
    function s1()
    {
        gs.TweenMax.to(mc, 2, {_x: roll(-30, 30), _y: roll(-30, 30), ease: gs.easing.Cubic.easeInOut, onComplete: s2});
    } // End of the function
    function s2()
    {
        gs.TweenMax.to(mc, 2, {_x: roll(-30, 30), _y: roll(-30, 30), ease: gs.easing.Cubic.easeInOut, onComplete: s1});
    } // End of the function
    s1();
} // End of the function
function checkpos()
{
    if (d_mc._x > Stage.width / 2 - d_mc._width)
    {
        d_mc._xscale = -100;
    }
    else if (d_mc._x < Stage.width / 2 + d_mc._width)
    {
        d_mc._xscale = 100;
    } // end else if
} // End of the function
function init()
{
    function s1()
    {
        if (_global.page == 0)
        {
            gs.TweenMax.to(mc, 2, {_xscale: rollScale, _yscale: rollScale});
            gs.TweenMax.to(d_mc, roll(1, 3), {_y: roll(0, Stage.height), _x: roll(0, Stage.width), _y: roll(-30, 30), ease: gs.easing.Cubic.easeInOut, onUpdate: checkpos, onComplete: s2});
        }
        else
        {
            gs.TweenMax.to(d_mc, roll(1, 3), {_y: roll(0, 200), _x: roll(0, 300), ease: gs.easing.Cubic.easeInOut, onUpdate: checkpos, onComplete: s2});
        } // end else if
    } // End of the function
    function s2()
    {
        if (_global.page == 0)
        {
            rollScale = roll(80, 100);
            gs.TweenMax.to(mc, 2, {_xscale: rollScale, _yscale: rollScale});
            gs.TweenMax.to(d_mc, 2, {_y: roll(0, Stage.height), _x: roll(0, Stage.width), _y: roll(-30, 30), ease: gs.easing.Cubic.easeInOut, onUpdate: checkpos, onComplete: s1});
        }
        else
        {
            gs.TweenMax.to(d_mc, roll(1, 3), {_y: roll(0, 200), _x: roll(0, 300), ease: gs.easing.Cubic.easeInOut, onUpdate: checkpos, onComplete: s2});
        } // end else if
    } // End of the function
    gs.TweenMax.to(d_mc, 1, {delay: 2, _alpha: 100});
    gs.TweenMax.from(d_mc, 3, {delay: 0, _xscale: 180, _yscale: 180});
    rollScale = roll(70, 100);
    gs.TweenMax.delayedCall(4, s1, [], false);
} // End of the function
d_mc = this;
this.onRelease = function ()
{
    function s1()
    {
        unloadMovie(this);
    } // End of the function
    gs.TweenMax.to(this, 2, {_alpha: 0, ease: Regular.easeOut});
};
this._alpha = 0;
gs.TweenMax.delayedCall(4, init, [], false);
gs.TweenMax.from(d_mc, 3, {delay: 5.500000, colorMatrixFilter: {saturation: 3, brightness: 5}, glowFilter: {color: 16763904, alpha: 1, blurX: 20, bluryY: 20, strength: 10}});
gs.TweenMax.from(d_mc, 3, {delay: 5.500000, _alpha: 0, blurFilter: {blurX: 20, bluryY: 20, strength: 10}});
